{% extends "datapanel/base.html" %}
{% block content %}
<style>
    .tasks-info th {
        text-align: center;
        font-size: 0.8rem;
        font-family: "Microsoft YaHei";
    }
    .tasks-info td {
        font-size: 0.8rem;
        font-family: "Microsoft JhengHei";
    }
    a.btn-danger {
        padding-left: 3px; 
        padding-right: 3px;
    }
</style>
{% load static %}
{% comment %} list tasks {% endcomment %}
{% load concat_string %}

<div class="row">
    <p class="display-5 mx-auto"> 爬虫任务管理</p>
    <table class="table tasks-info table-bordered table-striped mx-auto">
        <thead>
            <tr>
                <th>任务ID</th>
                <th>任务名称</th>
                <th>商品关键词</th>
                <th>类型</th>
                <th>开始时间</th>
                <th>结束时间</th>
                <th>cron_day</th>
                <th>cron_weekday</th>
                <th>cron_hour</th>
                <th>cron_min</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for t in tasks %}
                <tr>
                    <td> {{ t.id}} </td>
                    <td><a href="{% url 'datapanel:tasks_update' t.id %}"> {{ t.name}} </a></td>
                    <td> {{ t.kw }} </td>
                    <td> {{ t.type }}</td>
                    <td> {{ t.start_time  }}</td>
                    <td> {{ t.end_time}} </td>
                    <td> {{ t.cron_day }}</td>
                    <td> {{ t.cron_weekday }}</td>
                    <td> {{ t.cron_hour }}</td>
                    <td> {{ t.minute }}</td>
                    <td> {{ t.status }} </td>
                    <td> 
                        <a class="btn-danger" href="{% url 'datapanel:tasks_delete' t.id %}">删除</a>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
</div>

{% endblock content %}